package com.jwds.digital.bios.business.core.infrastructure.mapper.basic;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwds.digital.bios.business.core.infrastructure.dto.basic.BasicDictReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.entity.basic.BasicDict;
import com.jwds.digital.bios.business.core.infrastructure.vo.basic.BasicDictRespVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description BasicDictMapper
 * @Author xiao  xun
 * @Date 2024-12-07
 */
@Mapper
public interface BasicDictMapper  extends BaseMapper<BasicDict> {
    IPage<BasicDictRespVO> pageQuery(@Param("page") Page<BasicDictRespVO> page, @Param("condition") BasicDictReqDTO condition);

    /**
     * 树状查询
     * @return
     */
    List<BasicDictRespVO> list();

    /**
     * 数据字典树
     * @return
     */
   /* @Select("WITH RECURSIVE dict_tree AS (\n" +
            "    SELECT id, item_code, item_name, item_value, parent_code\n" +
            "    FROM basic_dict\n" +
            "    WHERE parent_code IS NULL\n" +
            "    UNION ALL\n" +
            "    SELECT t.id, t.item_code, t.item_name, t.item_value, t.parent_code\n" +
            "    FROM basic_dict t\n" +
            "    INNER JOIN dict_tree d ON t.parent_code = d.id\n" +
            ")\n" +
            "SELECT * FROM dict_tree\n")
    List<BasicDict> selectBasicDictTree();*/
}
